/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/ce/InterfaceLayout.cpp,v 1.4 2003/11/21 12:39:24 itsme Exp $
 *
 *
 * this module defines the layout of the buttons and texts in the
 * main cryptophone dialog.
 *
 */
#include "InterfaceLayout.h"
#include <windows.h>

RECT MakeRect(int x0, int xsize, int y0, int ysize)
{
    RECT r;
    r.left= x0;
    r.top= y0;
    r.right= x0+xsize;
    r.bottom= y0+ysize;

    return r;
}

void LoadLayout(InterfaceLayout& layout)
{
    const int mainleft= 4+4+6+3;
    const int maintop = 5;
    // 1st line
    layout.meter_linedelay= MakeRect(mainleft, 57,                          maintop, 15);
    layout.calltype=        MakeRect(layout.meter_linedelay.right+1, 35, maintop, 15);
    layout.sigarea=         MakeRect(layout.calltype.right+1, 112,       maintop, 31);

    // 2nd line
    layout.securestatus=    MakeRect(mainleft, 93,                          layout.meter_linedelay.bottom+1, 15);
    layout.yoursig=         MakeRect(layout.sigarea.left+7, 44,          layout.sigarea.top+12, 16);
    layout.partnersig=      MakeRect(layout.yoursig.right+6, 44,         layout.yoursig.top, 16);

    // 3rd line
    layout.status=          MakeRect(mainleft, 206,                         layout.sigarea.bottom+5, 20);
    layout.partnername=     MakeRect(mainleft, 206,                         layout.sigarea.bottom+5, 20);
    // 4th line
    layout.status2=         MakeRect(mainleft, 206,                         layout.partnername.bottom, 20);
    layout.partnernumber=   MakeRect(mainleft, 206,                         layout.partnername.bottom, 20);

    // top left side
    layout.meter_gsmsignal=  MakeRect(8, 6,    maintop, 67);
    // top right side
    layout.meter_batterlevel=MakeRect(226, 6,  maintop, 67);

    // must be a little smaller than specified, other wise the 'Q' does not display correctly
    layout.sig_font= 14;               // helvetica, bold, 16px, #003399
    //layout.calltype_font= 10;          // helvetica, bold, 10px, #003399
    layout.name_font= 16;              // helvetica, bold, 16px, #003399
    layout.number_font= 16;            // helvetica, bold, 16px, #003399


    // -----------------------------------------------
    // ---------- signature display ------------------

    // 1st line
    layout.bigsig_background= MakeRect(mainleft+2, 199,                        maintop, 47);

    // 2nd line
    layout.bigsig_yoursig=      MakeRect(mainleft+16, 81,                      maintop+17, 25);
    layout.bigsig_partnersig=   MakeRect(layout.bigsig_yoursig.right+5, 81,  layout.bigsig_yoursig.top, 25);

    // 3rd line
    layout.button_sigok=        MakeRect(layout.bigsig_background.left+12+89, 85, layout.bigsig_background.bottom, 30);

    layout.bigsig_bkcolor= RGB(229,229,229);

    layout.bigsig_font= 23;               // helvetica,bold,28px, #003399

    // -----------------------------------------------
    // ---------- key pad ----------------------------

    // btncols= 4, +64, +64, +74
    const int col0= 4;
    const int col1= col0+64;
    const int col2= col1+64;
    const int col3= col2+74;

    // btnrows= 118, +32, +34, +34, +34, +34
    const int row0= 92;
    const int row1= row0+32;
    const int row2= row1+34;
    const int row3= row2+34;
    const int row4= row3+34;
    const int row5= row4+36;    // 34 in measurement, 36 in example

    // 5th line
    layout.button_menu= MakeRect(col0, 60, row0, 24);
    layout.button_mute= MakeRect(col1, 60, row0, 24);
    layout.button_back= MakeRect(col2, 60, row0, 24);

    // 6th line
    layout.button_1= MakeRect(col0, 60, row1, 30);
    layout.button_2= MakeRect(col1, 60, row1, 30);
    layout.button_3= MakeRect(col2, 60, row1, 30);

    // 7th line
    layout.button_4= MakeRect(col0, 60, row2, 30);
    layout.button_5= MakeRect(col1, 60, row2, 30);
    layout.button_6= MakeRect(col2, 60, row2, 30);

    // 8th line
    layout.button_7= MakeRect(col0, 60, row3, 30);
    layout.button_8= MakeRect(col1, 60, row3, 30);
    layout.button_9= MakeRect(col2, 60, row3, 30);

    // 9th line
    layout.button_star=  MakeRect(col0, 60, row4, 30);
    layout.button_0=     MakeRect(col1, 60, row4, 30);
    layout.button_pound= MakeRect(col2, 60, row4, 30);

    // 10th line
    layout.button_callanswer= MakeRect(col0, 104, row5, 30);
    layout.button_hangup=     MakeRect(col2, 104, row5, 30);

    // bottom right side
    layout.button_up=   MakeRect(col3, 30, row1, 64);
    layout.button_down= MakeRect(col3, 30, row3, 64);

    layout.text_color = RGB(0, 51, 153);
    layout.defaultfontname= "Helvetica";

    layout.display= MakeRect(0, 240, 0, 320-26);
    layout.display_color= RGB(187,187,187);
    layout.display_border= true;
}
